<template>
    <div class="">
        <!-- 头部导航栏 -->
        <div class="head">
            <h3>食谱秀网</h3>
            <svg class="icon icon-caidan" aria-hidden="true" @click="show = !show">
                <use xlink:href="#icon-caidan"></use>
            </svg>
            <!-- 头部隐藏栏 -->
            <transition name="fade">
                <ul class="tab" v-if="!show">
                    <router-link to="/index">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-icons_statistics"></use>
                                </svg>
                                首页
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/classify">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                食材分类
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/Cookbook">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                菜谱大全
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/HomeCooked">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                家常菜谱
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/restriction">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-star"></use>
                                </svg>
                                食物相克
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/PregnantDiet">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                孕妇食谱
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/FoodInformation">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                美食资讯
                            </span>
                        </li>
                    </router-link>
                </ul>
            </transition>
        </div>
        <!-- 搜索 -->
        <div class="sousuo">
            <svg class="icon icon-fangdajing" aria-hidden="true">
                <use xlink:href="#icon-fangdajing1"></use>
            </svg>
            <input type="text" class="sousuo1" placeholder="请输入关键字例：羊肉">
            <router-link to="/search">
                <input type="submit"  class="sousuo2" value="搜索">
            </router-link>
        </div>
        <!-- 菜式 -->
        <ul class="foods">
            <li v-for="(item,index) in Cookbook" :key="index">
                <router-link to="/classify" style="text-decoration:none;">
                    <img :src="item.src" alt="">
                    <p>{{item.type}}</p>
                    <span>{{item.up}}</span>
                </router-link>
            </li>
        </ul>
        <!-- 底部  -->
        <div class="foot">
            Copyright 食谱秀 m.shipuxiu.com <br>
            <p> 
                官方微信号: <span style="color: #ff0000;">chaoliu1588 </span> 
                <router-link to="https://m.shipuxiu.com/fenlei/">食谱分类</router-link>
                <router-link to="https://support.qq.com/products/113359/">我要吐槽</router-link>
                <router-link to="https://new.cnzz.com/v1/login.php?siteid=5433565">站长统计 </router-link>
             </p> 
        </div>
    </div>
    
</template>
<script>
export default {
    data(){
        return{
            show:true,
            Cookbook:[]
        }
    },
    mounted(){
        // 获取数据
        this.$http.get('../../data/data.json')
        .then((response)=> {
            this.Cookbook = response.data.Cookbook
        })
        .catch(function (error) {
            console.log(error);
        })
        .then(function () {
            // always executed
        });
    }
}
</script>

<style scoped>
    /* 食物名称--隐藏 */
    .foods{
        margin-top: 10px;
        width: 100%;
        height: 133vh;
        background: #f5f5f5;
    }
    .foods li{
        width: 110%;
        height: 8vh;
        border-bottom: 1px solid #ededed;
        margin-left: -10px;
        background: #ffffff;

    }
    .foods li img{
        width: 9%;
        height: 5vh;
        margin-left: 30px;
        border-radius: 50%;
        margin-top: 10px;
    }
    .foods li p{
        font-size: 17px;
        text-align: center;
        color: #787878;
        margin-top: -35px;
        margin-left: -230px;
        
    }
    .foods span{
        display: block;
        color: #f56263;
        margin-top: -25px;
        margin-left: 413px;
        font-size: 12px;
        transform: scaleX(2.5);
        /* background: url("../../assets/images/cookbook/ic_scb.png") no-repeat 0px -272px; */
    }
</style>